.subckt XNOR30 A B C Q
MP7 6  8 vcc vcc PMOS L=0.35U W=1.02U
MP8 3  8 vcc vcc PMOS L=0.35U W=1.6U
MP9 3  C vcc vcc PMOS L=0.35U W=1.6U
MP6 9  C 6 vcc PMOS L=0.35U W=1.02U
MP10 Q 9 3 vcc PMOS L=0.35U W=1.6U
MP1 7  A vcc vcc PMOS L=0.35U W=0.4U
MP3 1  A vcc vcc PMOS L=0.35U W=1.6U
MP4 8  7 vcc vcc PMOS L=0.35U W=0.8U
MP2 7  B vcc vcc PMOS L=0.35U W=0.4U
MP5 8  B 1 vcc PMOS L=0.35U W=1.6U
MN6 9   8 gnd gnd NMOS L=0.35U W=0.4U
MN8 Q   8 4 gnd NMOS L=0.35U W=1U
MN9 4   C gnd gnd NMOS L=0.35U W=1U
MN7 9   C gnd gnd NMOS L=0.35U W=0.4U
MN10 Q  9 gnd gnd NMOS L=0.35U W=0.5U
MN1 5   A 7 gnd NMOS L=0.35U W=0.5U
MN4 gnd A 2 gnd NMOS L=0.35U W=1U
MN5 2   7 8 gnd NMOS L=0.35U W=1U
MN2 5   B gnd gnd NMOS L=0.35U W=0.5U
MN3 gnd B 2 gnd NMOS L=0.35U W=1U
.ends XNOR30

.subckt NAND42 A B C D out
MP1 out A vcc vcc PMOS L=0.35U W=3.2U
MP2 out B vcc vcc PMOS L=0.35U W=3.2U
MP3 out C vcc vcc PMOS L=0.35U W=3.2U
MP4 out D vcc vcc PMOS L=0.35U W=3.2U
MN1 35 A out gnd NMOS L=0.35U W=7.9U
MN2 27 B 35 gnd NMOS L=0.35U W=7.9U
MN3 23 C 27 gnd NMOS L=0.35U W=7.9U
MN4 gnd D 23 gnd NMOS L=0.35U W=7.9U
.ends NAND42

.subckt MUX21 A S B Q
MP0 5 S 1 vcc PMOS L=0.35U W=1.6U
MP1 1 A vcc vcc PMOS L=0.35U W=1.6U
MP2 SN S vcc vcc PMOS L=0.35U W=0.8U
MP3 5 SN 3 vcc PMOS L=0.35U W=1.6U
MP4 3 B vcc vcc PMOS L=0.35U W=1.6U
MP5 Q 5 vcc vcc PMOS L=0.35U W=1.6U
MN0 5 SN 2 gnd NMOS L=0.35U W=1U
MN1 gnd A 2 gnd NMOS L=0.35U W=1U
MN2 gnd S SN gnd NMOS L=0.35U W=0.5U
MN3 5 S 4 gnd NMOS L=0.35U W=1U
MN4 gnd B 4 gnd NMOS L=0.35U W=1U
MN5 Q 5 gnd gnd NMOS L=0.35U W=1U
.ends MUX21

.subckt INV15 in out vcc gnd
MP1 out in vcc vcc PMOS L=0.35U W=24U
MN1 out in gnd gnd NMOS L=0.35U W=15U
.ends INV15

.subckt INV in out vcc gnd
MP1 out in vcc vcc PMOS L=0.35U W=1.6U
MN1 out in gnd gnd NMOS L=0.35U W=1U
.ends INV

.subckt IMUX20 A S B Q
MP0 Q S 1 vcc PMOS L=0.35U W=1.6U
MP1 1 A vcc vcc PMOS L=0.35U W=1.6U
MP2 SN S vcc vcc PMOS L=0.35U W=0.8U
MP3 Q SN 3 vcc PMOS L=0.35U W=1.6U
MP4 3 B vcc vcc PMOS L=0.35U W=1.6U
MN0 Q SN 2 gnd NMOS L=0.35U W=1U
MN1 gnd A 2 gnd NMOS L=0.35U W=1U
MN2 gnd S SN gnd NMOS L=0.35U W=0.5U
MN3 Q S 4 gnd NMOS L=0.35U W=1U
MN4 gnd B 4 gnd NMOS L=0.35U W=1U
.ends IMUX20

.subckt IMAJ30 in out vcc gnd
MP1 29 A vcc vcc PMOS L=0.35U W=1.6U
MP2 Q B 29 vcc PMOS L=0.35U W=1.6U
MP3 26 A vcc vcc PMOS L=0.35U W=1.6U
MP4 26 B vcc vcc PMOS L=0.35U W=1.6U
MP5 Q C 26 vcc PMOS L=0.35U W=1.6U
MN1 gnd A 65 gnd NMOS L=0.35U W=1U
MN2 65 B Q gnd NMOS L=0.35U W=1U
MN3 gnd A 57 gnd NMOS L=0.35U W=1U
MN4 gnd B 57 gnd NMOS L=0.35U W=1U
MN5 57 C Q gnd NMOS L=0.35U W=1U
.ends IMAJ30


.subckt buff4 in out vcc gnd
MP1 vcc in 1 vcc PMOS L=0.35U W=1.6U
MP2 vcc 1 out vcc PMOS L=0.35U W=6.4U
MN1 gnd in 1 gnd NMOS L=0.35U W=1U
MN2 gnd 1 out gnd NMOS L=0.35U W=4U
.ends buff4

.subckt AOI2112 in out vcc gnd
MP1 7 a vcc vcc PMOS L=0.35U W=9.4U
MP2 7 b vcc vcc PMOS L=0.35U W=9.4U
MP3 15 c 7 vcc PMOS L=0.35U W=9.4U
MP4 out d 15 vcc PMOS L=0.35U W=9.4U
MN1 23 a out gnd NMOS L=0.35U W=3.7U
MN2 gnd b 23 gnd NMOS L=0.35U W=3.7U
MN3 gnd c out gnd NMOS L=0.35U W=2U
MN4 gnd d out gnd NMOS L=0.35U W=2U
.ends AOI2112


.subckt AOI210 in out vcc gnd
MP1 18 a vcc vcc PMOS L=0.35U W=1.6U
MP2 18 b vcc vcc PMOS L=0.35U W=1.6U
MP3 out c 18 vcc PMOS L=0.35U W=1.6U
MN1 14 a out gnd NMOS L=0.35U W=1U
MN2 gnd b 14 gnd NMOS L=0.35U W=1U
MN3 gnd c out gnd NMOS L=0.35U W=1U
.ends AOI210


.subckt add32 a b ci s vcc gnd
MP1  vcc A  1  vcc  PMOS  L=0.35U W=3.2U 
MP2  1   B  2  vcc  PMOS  L=0.35U W=3.2U 
MP3  vcc A  3  vcc  PMOS  L=0.35U W=3.2U 
MP4  vcc B  3  vcc  PMOS  L=0.35U W=3.2U 
MP5  3   C_ 2  vcc  PMOS  L=0.35U W=3.2U 
MP7  5   2  4  vcc  PMOS  L=0.35U W=3.2U 
MP8  vcc CI 5  vcc  PMOS  L=0.35U W=3.2U 
MP9  vcc B  5  vcc  PMOS  L=0.35U W=3.2U 
MP10 vcc A  5  vcc  PMOS  L=0.35U W=3.2U 
MP11 6   CI 4  vcc  PMOS  L=0.35U W=3.2U 
MP12 7   B  6  vcc  PMOS  L=0.35U W=3.2U 
MP13 vcc A  7  vcc  PMOS  L=0.35U W=3.2U 
MN1  gnd A  8  gnd  NMOS  L=0.35U W=2U 
MN2  8   B  2  gnd  NMOS  L=0.35U W=2U 
MN3  gnd A  10 gnd  NMOS  L=0.35U W=2U 
MN4  gnd B  10 gnd  NMOS  L=0.35U W=2U 
MN5  10  C_ 2  gnd  NMOS  L=0.35U W=2U 
MN7  11  2  4  gnd  NMOS  L=0.35U W=2U 
MN8  gnd CI 11 gnd  NMOS  L=0.35U W=2U 
MN9  gnd B  11 gnd  NMOS  L=0.35U W=2U 
MN10 gnd A  11 gnd  NMOS  L=0.35U W=2U 
MN11 12  CI 4  gnd  NMOS  L=0.35U W=2U 
MN12 13  B  12 gnd  NMOS  L=0.35U W=2U 
MN13 gnd A  13 gnd  NMOS  L=0.35U W=2U 
.ends add32

.subckt add32_gt a b ci s vcc gnd
MP1  vcc A  1  vcc  PMOS  L=0.35U W=3.2U 
MP3  vcc A  3  vcc  PMOS  L=0.35U W=3.2U 
MP10 vcc A  5  vcc  PMOS  L=0.35U W=3.2U 
MP2  1   B  2  vcc  PMOS  L=0.35U W=3.2U 
MP4  vcc B  3  vcc  PMOS  L=0.35U W=3.2U 
MP9  vcc B  5  vcc  PMOS  L=0.35U W=3.2U 
MP12 7   B  6  vcc  PMOS  L=0.35U W=3.2U 
MP5  3   C_ 2  vcc  PMOS  L=0.35U W=3.2U 
MP7  5   2  4  vcc  PMOS  L=0.35U W=3.2U 
MP8  vcc CI 5  vcc  PMOS  L=0.35U W=3.2U 
MP11 6   CI 4  vcc  PMOS  L=0.35U W=3.2U 
MP13 vcc A  7  vcc  PMOS  L=0.35U W=3.2U 
MN1  gnd A  8  gnd  NMOS  L=0.35U W=2U 
MN3  gnd A  10 gnd  NMOS  L=0.35U W=2U 
MN10 gnd A  11 gnd  NMOS  L=0.35U W=2U 
MN13 gnd A  13 gnd  NMOS  L=0.35U W=2U 
MN2  8   B  2  gnd  NMOS  L=0.35U W=2U 
MN4  gnd B  10 gnd  NMOS  L=0.35U W=2U 
MN9  gnd B  11 gnd  NMOS  L=0.35U W=2U 
MN12 13  B  12 gnd  NMOS  L=0.35U W=2U 
MN5  10  C_ 2  gnd  NMOS  L=0.35U W=2U 
MN7  11  2  4  gnd  NMOS  L=0.35U W=2U 
MN8  gnd CI 11 gnd  NMOS  L=0.35U W=2U 
MN11 12  CI 4  gnd  NMOS  L=0.35U W=2U 
.ends add32_gt
